package com.blue;

import com.blue.utils.GlobalConfInfo;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        //
        setInstallProMap();

        Parent root = FXMLLoader.load(getClass().getResource("/fxml/main.fxml"));
        //Scene scene = new Scene( root,500,344 );
        Scene scene = new Scene( root );
        scene.getStylesheets().add("/css/style.css");
        //primaryStage.setMaximized(true);
        primaryStage.getIcons().add(new Image("/img/logo.png"));
        primaryStage.setScene( scene );
        //primaryStage.sizeToScene();
        //primaryStage.setResizable(false);
        primaryStage.setTitle("Admin Login of BLUE");
        primaryStage.setMaximized(true);
        primaryStage.show();
        /*primaryStage.setTitle("欢迎使用我的软件");
        //primaryStage.setScene(new Scene(root, 300, 275));
        Product root = new Product(primaryStage);
        Scene scene = new Scene(root,950,500);
        //scene.getStylesheets().add("/css/style.css");
        //primaryStage.setMaximized(true);
        primaryStage.setScene(scene);
        //固定窗体大小
        primaryStage.sizeToScene();
        primaryStage.setResizable(false);
        primaryStage.show();*/
    }


    public static void main(String[] args) {
        launch(args);
    }

    //设置需要安装的项目信息
    private void setInstallProMap(){
        Map<String, String> map = new HashMap<String, String>();
        //windows
        map.put("Tomcat", "Tomcat.png,apache-tomcat-8.5.14.zip");
        //linux
        //map.put("Tomcat", "Tomcat.png,apache-tomcat-8.5.35.tar.gz");
        map.put("a", "a.png,mybatisboot-0.0.2.war");
        map.put("b", "b.png,b.war:d.war");
        map.put("c", "c.png,aop-0.1.war");
        //增加war包项目

        List<String> list = new ArrayList<String>();
        list.add("product");
        list.add("a");
        list.add("b");
        list.add("c");
        list.add( "education" );
        GlobalConfInfo.setProjectList(list);
        GlobalConfInfo.setProjectMap(map);
    }
}
